/**
 * 作者: wgx
 * 日期: 2025-04-11 10:58:33
 * 备注: 用户称号激活信息
 */
package com.motu.monstercity.server.game.userdata;

import com.motu.monstercity.server.game.commondata.system.DecorateMain;
import com.motu.monstercity.server.game.commondata.system.SystemConstant;
import com.motu.monstercity.server.game.logic.GameDataManager;
import com.motu.vertx.module.utility.toolset.TimeUtils;

public class UserTitle extends UserTitleModel {
    public UserTitle() {
        super();
    }

    // 称号是否过期,加成失效
    public boolean isExpired(long checkTime) {
        DecorateMain decorateMain = GameDataManager.getDecorateMain(getDecorateId());
        if (decorateMain == null || decorateMain.getType() != SystemConstant.DECORATE_TYPE_3) {
            return true;// 已过期
        }

        if (decorateMain.getOnTime() == 0) {// 无限期
            return false;
        }

        long endTime = getActiveTime() + decorateMain.getOnTime();// 称号的失效时间
        if (endTime >= checkTime) {
            return false;// 未过期
        } else {
            return true;
        }
    }
}
